package cn.iocoder.aics.module.member.controller.app.chathistory.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

@Data
public class ChatResponse {

    @Schema(description = "唯一标识符")
    private String id;

    @Schema(description = "对象类型")
    private String object;

    @Schema(description = "创建时间戳")
    private long created;

    @Schema(description = "模型名称")
    private String model;

    @Schema(description = "选择列表")
    private List<Choice> choices;

    @Schema(description = "使用情况")
    private Usage usage;

    @Schema(description = "系统指纹")
    @JsonProperty("system_fingerprint")
    private String systemFingerprint;

    @Data
    public static class Choice {
        @Schema(description = "索引")
        private int index;

        @Schema(description = "消息")
        private Message message;

        @Schema(description = "对数概率")
        private Object logprobs;

        @Schema(description = "完成原因")
        @JsonProperty("finish_reason")
        private String finishReason;
    }

    @Data
    public static class Message {
        @Schema(description = "角色")
        private String role;

        @Schema(description = "内容")
        private String content;

        @Schema(description = "推理内容")
        @JsonProperty("reasoning_content")
        private String reasoningContent;
    }

    @Data
    public static class Usage {
        @Schema(description = "提示标记数")
        @JsonProperty("prompt_tokens")
        private int promptTokens;

        @Schema(description = "完成标记数")
        @JsonProperty("completion_tokens")
        private int completionTokens;

        @Schema(description = "总标记数")
        @JsonProperty("total_tokens")
        private int totalTokens;

        @Schema(description = "提示标记详细信息")
        @JsonProperty("prompt_tokens_details")
        private PromptTokensDetails promptTokensDetails;

        @Schema(description = "完成标记详细信息")
        @JsonProperty("completion_tokens_details")
        private CompletionTokensDetails completionTokensDetails;

        @Schema(description = "提示缓存命中标记数")
        @JsonProperty("prompt_cache_hit_tokens")
        private int promptCacheHitTokens;

        @Schema(description = "提示缓存未命中标记数")
        @JsonProperty("prompt_cache_miss_tokens")
        private int promptCacheMissTokens;
    }

    @Data
    public static class PromptTokensDetails {
        @Schema(description = "缓存标记数")
        @JsonProperty("cached_tokens")
        private int cachedTokens;
    }

    @Data
    public static class CompletionTokensDetails {
        @Schema(description = "推理标记数")
        @JsonProperty("reasoning_tokens")
        private int reasoningTokens;
    }
}
